import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:yp/config/style.dart';

class EsSwitch extends StatelessWidget {
  /// 初始状态
  final bool status;

  /// 大小 比例缩放 默认0.7
  final double scale;

  /// 开关事件
  final Function(bool) onChanged;
  const EsSwitch({Key key, this.status, this.onChanged, this.scale = 0.7})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Transform.scale(
      scale: scale,
      child: CupertinoSwitch(
        value: status ?? true,
        activeColor: EsColors.Primary,
        onChanged: onChanged ??
            (value) {
              print(value);
            },
      ),
    );
  }
}
